package com.hpjz.common.utils;

import javax.annotation.Resource;
import javax.servlet.ServletContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class ServletContextUtil {
	
	@Autowired
	private static ServletContext servletContext;

	
	public void setServletContext(ServletContext sc) {
		ServletContextUtil.servletContext = sc;
	}

	public static ServletContext getServletContext() {
		return servletContext;
	}

	public static String getHomePath() {
		return ServletContextUtil.servletContext.getRealPath("/");
	}
	
	public static String getContextPath(){
        return ServletContextUtil.servletContext.getContextPath();		
	}
    
	
}
